$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER OLD_MODE
      INTEGER READ_STATUS, WRITE_STATUS
      INTEGER FG_GETMODE, FG_MAKEPCX, FG_SHOWPCX, FG_TESTMODE

      CALL FG_INITPM
      IF (FG_TESTMODE(19,1) .EQ. 0) THEN
         STOP 'This program requires a 320 x 200 MCGA graphics mode.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(19)

      READ_STATUS = FG_SHOWPCX('CORAL.PCX'//CHAR(0),0)
      CALL FG_WAITKEY
      IF (READ_STATUS .EQ. 0) THEN
         WRITE_STATUS = FG_MAKEPCX(0,319,80,99,'NEW.PCX'//CHAR(0))
      ELSE
         WRITE_STATUS = 1
      END IF

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      IF (READ_STATUS .EQ. 1) THEN
         WRITE(6,*) 'CORAL.PCX not found.'
      ELSE IF (READ_STATUS .EQ. 2) THEN
         WRITE(6,*) 'CORAL.PCX is not a PCX file.'
      END IF
      IF (WRITE_STATUS .EQ. 1) WRITE(6,*) 'NEW.PCX not created.'

      STOP ' '
      END
